package com.powerbank.common.event.device;

import com.powerbank.common.event.BaseEvent;
import lombok.Data;
import java.time.LocalDateTime;

/**
 * 设备状态变更事件
 */
@Data
public class DeviceStatusChangedEvent extends BaseEvent {

    /**
     * 设备ID
     */
    private Long deviceId;

    /**
     * 设备编号
     */
    private String deviceCode;

    /**
     * 旧状态
     */
    private String oldStatus;

    /**
     * 新状态
     */
    private String newStatus;

    /**
     * 变更原因
     */
    private String reason;

    /**
     * 创建时间
     */
    private LocalDateTime createdTime;

    public DeviceStatusChangedEvent() {
        super("DEVICE_STATUS_CHANGED", "device-center");
        this.createdTime = LocalDateTime.now();
    }

    public DeviceStatusChangedEvent(Long deviceId, String deviceCode, String oldStatus, String newStatus, String reason) {
        super("DEVICE_STATUS_CHANGED", "device-center");
        this.deviceId = deviceId;
        this.deviceCode = deviceCode;
        this.oldStatus = oldStatus;
        this.newStatus = newStatus;
        this.reason = reason;
        this.createdTime = LocalDateTime.now();
    }
}